﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WoBian.Entities.Admin;
using WoBian.Common;
namespace WoBian.Models.Admin.User
{
    public class AdminUserModel
    {
        public string UserId { get; set; }

        public string Address { get; set; }

        public string EMailAddress { get; set; }

        public string IdNumber { get; set; }

        public string IsLock { get; set; }

        public string MobilePhone { get; set; }

        public string Name { get; set; }

        public string NickName { get; set; }

        public string Password { get; set; }

        public byte[] Picture { get; set; }

        public string Remark { get; set; }

        public string TrueName { get; set; }

        public int Age { get; set; }

        private AdminUser ToAdminUser()
        {
            AdminUser adminUser = new AdminUser();
            adminUser.UserId = this.UserId;
            adminUser.Address = this.Address;
            adminUser.EMailAddress = this.EMailAddress;
            adminUser.IdNumber = this.IdNumber;
            adminUser.IsLock = this.IsLock;
            adminUser.MobilePhone = this.MobilePhone;
            adminUser.Name = this.Name;
            adminUser.NickName = this.NickName;
            adminUser.Password = this.Password.ToMd5();
            adminUser.Picture = this.Picture;
            adminUser.Remark = this.Remark;
            adminUser.TrueName = this.TrueName;
            adminUser.Age = this.Age;
            return adminUser;
        }

        public string SaveAdminUser()
        {
            AdminUser aAdminUser = ToAdminUser();
            return WoBian.Logic.Admin.User.AdminUserLogic.Save(aAdminUser);
        }

        public bool DataValidate(AdminUser AdminUser)
        {
            return false;
        }
    }
}
